@extends('admin.admin')

@section('content')
        <!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        用户管理
        <small>角色列表</small>
        <small>添加</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 控制面板</a></li>
        <li ><a href="#">用户管理</a></li>
        <li ><a href="/admin/admin_role">角色列表</a></li>
        <li class="active">添加</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">

    <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">角色添加</h3>
                    <div class="pull-right">
                        <a href="{{Route('admin.admin_role.index')}}" type="button" class="btn btn-block btn-success btn-xs"><i class="icon  glyphicon glyphicon glyphicon-menu-left"></i> 返回</a>
                    </div>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                {!! Form::model($adminRole,['route'=>'admin.admin_role.store'])  !!}
                    {!! Form::hidden('back_url',@$_SERVER['HTTP_REFERER']) !!}
                    <div class="box-body">
                        <div class="form-group @if($errors->has('role_name')) has-error   @endif">
                            <label for="exampleInputEmail1">角色名</label>
                            {!! Form::text('role_name',old('role_name'),array('class'=>'form-control','placeholder'=>'请填写角色名'))!!}
                            @if($errors->has('role_name'))
                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('role_name')}}</label>
                            @endif
                        </div>
                  
                        <div class="form-group">
                            <label for="exampleInputPassword1">描述</label>
                            {!! Form::textarea('description',old('description'),array('class'=>'form-control','placeholder'=>'请填写描述','rows'=>3))!!}
                        </div>
                        <div class="form-group">
                            <label for="exampleInputPassword1">权限设置</label>
                            <table class="table table-hover">
                                @foreach ($acls as $acl=>$sons)
                                    <tr>
                                        <td class="J-p">
                                            <label class="checkbox-inline">
                                                {!! Form::checkbox('role_priv[]',$acl,0,array('class'=>'minimal')) !!}
                                                <span style="vertical-align: bottom">&nbsp;{{$sons['name']}}</span>
                                            </label>
                                        </td>

                                        @foreach ($sons as $key=>$son)
                                            @if($key!='name')
                                            <td class="J-son">
                                                <label class="checkbox-inline">
                                                    {!! Form::checkbox('role_priv[]',$key,0,array('class'=>'minimal')) !!}
                                                    <span style="vertical-align: bottom">&nbsp;{{$son}}</span>
                                                </label>
                                            </td>
                                            @endif
                                        @endforeach


                                    </tr>
                                @endforeach
                            </table>
                        </div>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                {!! Form::close()  !!}
            </div>
            <!-- /.box -->
        </div>
    </div>



</section>
<!-- /.content -->
@endsection